package com.cms.bs.util;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class Log4jUtil {

	private static Logger log = null;
	
	/**
	 * 获取 实例
	 * @param clazzName
	 * @return
	 */
	private static Logger getInstance(String clazzName){
		log = LogManager.getLogger(clazzName);
		return log;
	}
	
	/**
	 * INFO 级别 日志 输出
	 * @param clazzName
	 * @param message
	 */
	public static void info(String clazzName, String message){
		log = getInstance(clazzName);
		log.info(message);
	}
	
	public static void info(String clazzName, String title, Object message){
		log = getInstance(clazzName);
		log.info("[" + title + "]=>" + message);
	}
	
	/**
	 * INFO 级别 日志 输出
	 * @param clazzName
	 * @param message
	 * @param throwable
	 */
	public static void info(String clazzName, String message, Throwable throwable){
		log = getInstance(clazzName);
		log.info(message, throwable);
	}
	
	public static void info(String clazzName, String title, String message, Throwable throwable){
		log = getInstance(clazzName);
		log.info("[" + title + "]=>" + message, throwable);
	}
	
	/**
	 * ERROR 级别的日志输出
	 * @param clazzName
	 * @param message
	 */
	public static void error(String clazzName, String message){
		log = getInstance(clazzName);
		log.error(message);
	}
	
	public static void error(String clazzName, String title, String message){
		log = getInstance(clazzName);
		log.error("[" + title + "]=>" + message);
	}
	
	/**
	 * ERROR 级别的日志输出
	 * @param clazzName
	 * @param message
	 * @param throwable
	 */
	public static void error(String clazzName, String message, Throwable throwable){
		log = getInstance(clazzName);
		log.error(message, throwable);
	}
	
	public static void error(String clazzName, String title, Object message, Throwable throwable){
		log = getInstance(clazzName);
		log.error("[" + title + "]=>" + message, throwable);
	}
	
}
